home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE09
/
SAFELIST
/
OLDSHAPE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-04-15
|
1KB
|
45 lines
{ File OLDSHAPE.PAS -- original Shapes unit }
unit Shapes;
interface
uses Graphics;
type
{Base class of the shapes to draw}
TMyShape = class(TObject)
private
fSize : Integer;
fTop : Integer;
fLeft : Integer;
fColour : TColor;
public
property Size : Integer read fSize write fSize;
property Top : Integer read fTop write fTop;
property Left : Integer read fLeft write fLeft;
property Colour : TColor read fColour write fColour;
procedure Draw(Dest : TCanvas); virtual;
end;
TCircle = class(TMyShape)
public
procedure Draw(Dest : TCanvas); override;
end;
TSquare = class(TMyShape)
public
procedure Draw(Dest : TCanvas); override;
end;
implementation
procedure TMyShape.Draw(Dest : TCanvas);
begin
Dest.Pen.Color := Colour;
Dest.Brush.Color := Colour;
end;
procedure TCircle.Draw(Dest : TCanvas);
begin
inherited Draw(Dest);
Dest.Ellipse(Left,Top,Left + Size,Top + Size);
end;
procedure TSquare.Draw(Dest : TCanvas);
begin
inherited Draw(Dest);
Dest.Rectangle(Left,Top,Left + Size,Top + Size);
end;
end.